package com.tianqu.tms.entity;

import java.sql.Date;
import java.util.ArrayList;
import java.util.List;

import com.tianqu.tms.core.base.TmsEntity;
import com.tianqu.tms.core.exception.TmsDaoException;
import com.tianqu.tms.core.exception.TmsException;
import com.tianqu.tms.dao.ProxyCarPaymentDao;
import com.tianqu.tms.dao.TmsDao;
import com.tianqu.tms.dto.ProxyCarPaymentDto;

/**
 * 
 * 车辆代办收费信息表
 * 
 * @author Administrator
 * 
 */
public class ProxyCarPayment extends TmsEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = -6530745401125617041L;

	private int id;

	private String serial;// 车辆ID

	private int amount;// 缴费金额

	private int status;// 状态

	private int chargeType;// 缴费状态

	private Date insertTime;// 受理日期

	private Date updateTime;// 更新时间

	private int insertUserId;// 受礼人

	private int updateUserId;// 更新用户
	
	
	/**
	 * 初始化加载
	 * 
	 * @return
	 */
	public static ProxyCarPayment getInstance() {
		ProxyCarPayment proxy = new ProxyCarPayment();
		proxy.setExisting(false);
		return proxy;
	}
	
	/**
	 * 根据车辆ID查询所有代缴费信息
	 * @param serial
	 * @return
	 * @throws TmsDaoException 
	 */
	public List<ProxyCarPayment> findProxyCarPaymentInfoBySerial(String serial) throws TmsDaoException
	{
		ProxyCarPaymentDao mDao = (ProxyCarPaymentDao) TmsDao.getInstance(TmsDao.TMS_PROXY_CAR_PAYMENT);
		
		List<ProxyCarPaymentDto> list = mDao.findProxyCarPaymentInfoBySerial(serial);
		
		List<ProxyCarPayment> entityList = new ArrayList<ProxyCarPayment>();
		
		if(list.size() > 0)
		{
			for(int i=0;i<list.size();i++)
			{
				ProxyCarPaymentDto dto = list.get(i);
				ProxyCarPayment entity = new ProxyCarPayment();
				entity.setId(dto.getId());
				entity.setSerial(dto.getSerial());
				entity.setAmount(dto.getAmount());
				entity.setStatus(dto.getStatus());
				entity.setChargeType(dto.getChargeType());
				entity.setInsertTime(dto.getInsertTime());
				entity.setUpdateTime(dto.getUpdateTime());
				entity.setInsertUserId(dto.getInsertUserId());
				entity.setUpdateUserId(dto.getUpdateUserId());
				entityList.add(entity);
			}
		}
		return entityList;
	}

	/**
	 * 更新待办缴费信息
	 * 
	 * @return
	 * @throws TmsDaoException 
	 */
	public void updateCarProxyBySerial(String serial,int outPay,int status,int chargStstus,int userId) throws TmsDaoException
	{
		ProxyCarPaymentDao mDao = (ProxyCarPaymentDao) TmsDao.getInstance(TmsDao.TMS_PROXY_CAR_PAYMENT);
		
		mDao.updateCarProxyBySerial(serial,outPay,status,chargStstus,userId);
	}
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getSerial() {
		return serial;
	}

	public void setSerial(String serial) {
		this.serial = serial;
	}

	public int getAmount() {
		return amount;
	}

	public void setAmount(int amount) {
		this.amount = amount;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public int getChargeType() {
		return chargeType;
	}

	public void setChargeType(int chargeType) {
		this.chargeType = chargeType;
	}

	public Date getInsertTime() {
		return insertTime;
	}

	public void setInsertTime(Date insertTime) {
		this.insertTime = insertTime;
	}

	public Date getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}

	public int getInsertUserId() {
		return insertUserId;
	}

	public void setInsertUserId(int insertUserId) {
		this.insertUserId = insertUserId;
	}

	public int getUpdateUserId() {
		return updateUserId;
	}

	public void setUpdateUserId(int updateUserId) {
		this.updateUserId = updateUserId;
	}

	@Override
	public void save() throws TmsDaoException, TmsException {
		// TODO Auto-generated method stub

	}

}
